﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:uc="clr-namespace:FileExplorer.WPF.UserControls"
    xmlns:bc="clr-namespace:FileExplorer.WPF.BaseControls"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Buttons.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="SwitchTemplate" TargetType="{x:Type bc:Switch}">
        <Grid>
            <ContentPresenter Content="{TemplateBinding ContentOn}" 
                              Visibility="{Binding IsSwitchOn, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource btvc}}" />
            <ContentPresenter Content="{TemplateBinding ContentOff}" Visibility="{Binding IsSwitchOn,
                RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource fbtvc}}" />
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="BreadcrumbSwitchTemplate" TargetType="{x:Type bc:Switch}">
        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
            <ToggleButton x:Name="PART_Toggle"  Grid.Column="0"  Padding="2,0" VerticalAlignment="Stretch"
                                  IsChecked="{Binding IsSwitchOn, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" 
                                  Focusable="False"
                                  Template="{StaticResource BlankButton}" Background="Transparent" >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>


                    <bc:HotTrack Grid.Column="0" 
                                 x:Name="PART_ToggleHotTrack"
                                 Width="{Binding ActualHeight, ElementName=PART_ToggleHotTrack}">
                        <ContentControl ContentTemplate="{TemplateBinding HeaderTemplate}"    Content="{TemplateBinding Header}" Margin="2" />
                    </bc:HotTrack>


                    <Grid Grid.Column="1" Margin="2,0">
                        <ContentPresenter 
                            x:Name="PART_ContentOn"
                            Content="{TemplateBinding ContentOn}" 
                            Visibility="{Binding IsSwitchOn,
                                RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource btv},Mode=OneWay}" />
                        <ContentPresenter 
                            x:Name="PART_ContentOff"
                            Content="{TemplateBinding ContentOff}" 
                                          Visibility="{Binding IsSwitchOn,
                                RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource fbtv},Mode=OneWay}" />
                    </Grid>

                </Grid>
            </ToggleButton>
        </Border>
    </ControlTemplate>

    <Style TargetType="{x:Type bc:Switch}">
        <Setter Property="Template" Value="{StaticResource SwitchTemplate}" />
        <Setter Property="Focusable" Value="False" />
    </Style>


</ResourceDictionary>